/* eslint-disable */
'use strict'

const mysql = require('mysql')

const configs = {
  dev: {
    host: "127.0.0.1",
    port: "3306",
    user: "root",
    password: "yang1019",
    database: "InfM"
  },
  prod: {
    host: "127.0.0.1",
    port: "3306",
    user: "root",
    password: "yang1019",
    database: "InfM"
  }
}

module.exports = (env) => {
  if (env in configs) {
    let config = configs[env]
    config.connectionLimit = 10
    return mysql.createPool(config)
  } else {
    throw new Error('Database config is missing for' + env)
  }
}